package net.oschina.app.testcases.favorites;

import net.oschina.app.pages.PageAbout;
import net.oschina.app.pages.PageCommon;
import net.oschina.app.pages.PageLogin;
import net.oschina.app.pages.PageMyTab;
import net.oschina.app.pages.PageNavigation;
import net.oschina.app.pages.PageNews;
import net.oschina.app.pages.PageNewsDetail;
import net.oschina.app.pages.PageSettings;

/**
 * Created by Administrator on 2017/7/1.
 */

public class Helper {

    private SoloWrap solo;

    PageLogin pageLogin;
    PageCommon pageCommon;
    PageMyTab pageMyTab;
    PageNavigation pageNavigation;
    PageSettings pageSettings;
    PageAbout pageAbout;
    PageNews pageNews;
    PageNewsDetail pageNewsDetail;


    public Helper(SoloWrap solo) {
        this.solo = solo;
    }

    //获取PageLogin 的方法

    public PageLogin getPageLogin() {
        if (pageLogin == null) {
            pageLogin = new PageLogin(solo);
        }
        pageLogin.initViews();
        return pageLogin;
    }

    public PageCommon getPageCommon() {
        if (pageCommon == null) {
            pageCommon = new PageCommon(solo);
        }
        return pageCommon;
    }

    public PageMyTab getPageMyTab() {
        if (pageMyTab == null) {
            pageMyTab = new PageMyTab(solo);
        }
        //通过对象引用  找一下这些控件
        pageMyTab.initViews();
        // return 出去 控件
        return pageMyTab;
    }

    public PageNavigation getPageNavigation() {
        if (pageNavigation == null) {
            pageNavigation = new PageNavigation(solo);
        }
        return pageNavigation;
    }

    public PageSettings getPageSettings() {
        if (pageSettings == null) {
            pageSettings = new PageSettings(solo);
        }
        pageSettings.initViews();
        return pageSettings;
    }

    public PageAbout getPageAbout() {
        if (pageAbout == null) {
            pageAbout = new PageAbout(solo);
        }
        pageAbout.initViews();
        return pageAbout;
    }

    public PageNews getPageNews() {
        if (pageNews == null) {
            pageNews = new PageNews(solo);
        }
        pageNews.initViews();
        return pageNews;
    }

    public PageNewsDetail getPageNewsDetail() {
        if (pageNewsDetail == null) {
            pageNewsDetail = new PageNewsDetail(solo);
        }
        pageNewsDetail.initViews();
        return pageNewsDetail;
    }

}
